home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Text / WASTE / WASTE 1.1.2 Distribution / Pseudo-UPI for THINK Pascal / Icons.p < prev    next >
Encoding:
Text File  |  1995-10-12  |  10.2 KB  |  373 lines  |  [TEXT/PJMM]

  1. unit Icons;
  2.  
  3. { Pascal Interface to the Macintosh Libraries }
  4.  
  5. { Copyright © Apple Computer Inc. }
  6. { All Rights Reserved }
  7.  
  8. { Adapted for use with THINK Pascal 4.0.x by Marco Piovanelli }
  9.  
  10. interface
  11.     uses
  12.         Types;
  13.  
  14.     const
  15.  
  16. { The following are icons for which there are both icon suites and SICNs. }
  17.         genericDocumentIconResource = -4000;
  18.         genericStationeryIconResource = -3985;
  19.         genericEditionFileIconResource = -3989;
  20.         genericApplicationIconResource = -3996;
  21.         genericDeskAccessoryIconResource = -3991;
  22.         genericFolderIconResource = -3999;
  23.         privateFolderIconResource = -3994;
  24.         floppyIconResource = -3998;
  25.         trashIconResource = -3993;
  26. { The following are icons for which there are SICNs only. }
  27.         desktopIconResource = -3992;
  28.         openFolderIconResource = -3997;
  29.         genericHardDiskIconResource = -3995;
  30.         genericFileServerIconResource = -3972;
  31.         genericSuitcaseIconResource = -3970;
  32.         genericMoverObjectIconResource = -3969;
  33. { The following are icons for which there are icon suites only. }
  34.         genericPreferencesIconResource = -3971;
  35.         genericQueryDocumentIconResource = -16506;
  36.         genericExtensionIconResource = -16415;
  37.         systemFolderIconResource = -3983;
  38.         appleMenuFolderIconResource = -3982;
  39.  
  40.         startupFolderIconResource = -3981;
  41.         ownedFolderIconResource = -3980;
  42.         dropFolderIconResource = -3979;
  43.         sharedFolderIconResource = -3978;
  44.         mountedFolderIconResource = -3977;
  45.         controlPanelFolderIconResource = -3976;
  46.         printMonitorFolderIconResource = -3975;
  47.         preferencesFolderIconResource = -3974;
  48.         extensionsFolderIconResource = -3973;
  49.         fontsFolderIconResource = -3968;
  50.         fullTrashIconResource = -3984;
  51.         large1BitMask = 'ICN#';
  52.         large4BitData = 'icl4';
  53.         large8BitData = 'icl8';
  54.         small1BitMask = 'ics#';
  55.         small4BitData = 'ics4';
  56.         small8BitData = 'ics8';
  57.         mini1BitMask = 'icm#';
  58.         mini4BitData = 'icm4';
  59.         mini8BitData = 'icm8';
  60.  
  61. {  alignment type values  }
  62.         atNone = $0;
  63.         atVerticalCenter = $1;
  64.         atTop = $2;
  65.         atBottom = $3;
  66.         atHorizontalCenter = $4;
  67.         atAbsoluteCenter = atVerticalCenter + atHorizontalCenter;
  68.         atCenterTop = atTop + atHorizontalCenter;
  69.         atCenterBottom = atBottom + atHorizontalCenter;
  70.         atLeft = $8;
  71.         atCenterLeft = atVerticalCenter + atLeft;
  72.         atTopLeft = atTop + atLeft;
  73.         atBottomLeft = atBottom + atLeft;
  74.         atRight = $C;
  75.         atCenterRight = atVerticalCenter + atRight;
  76.         atTopRight = atTop + atRight;
  77.         atBottomRight = atBottom + atRight;
  78.  
  79.  
  80.     type
  81.         IconAlignmentType = INTEGER;
  82.  
  83. {  transform type values  }
  84.  
  85.     const
  86.         ttNone = $0;
  87.         ttDisabled = $1;
  88.         ttOffline = $2;
  89.         ttOpen = $3;
  90.         ttLabel1 = $0100;
  91.         ttLabel2 = $0200;
  92.         ttLabel3 = $0300;
  93.         ttLabel4 = $0400;
  94.         ttLabel5 = $0500;
  95.         ttLabel6 = $0600;
  96.         ttLabel7 = $0700;
  97.         ttSelected = $4000;
  98.         ttSelectedDisabled = ttSelected + ttDisabled;
  99.         ttSelectedOffline = ttSelected + ttOffline;
  100.         ttSelectedOpen = ttSelected + ttOpen;
  101.  
  102.  
  103.     type
  104.         IconTransformType = INTEGER;
  105.  
  106. {  Selector mask values  }
  107.  
  108.     const
  109.         svLarge1Bit = $00000001;
  110.         svLarge4Bit = $00000002;
  111.         svLarge8Bit = $00000004;
  112.         svSmall1Bit = $00000100;
  113.         svSmall4Bit = $00000200;
  114.         svSmall8Bit = $00000400;
  115.         svMini1Bit = $00010000;
  116.         svMini4Bit = $00020000;
  117.         svMini8Bit = $00040000;
  118.         svAllLargeData = $000000ff;
  119.         svAllSmallData = $0000ff00;
  120.         svAllMiniData = $00ff0000;
  121.         svAll1BitData = svLarge1Bit + svSmall1Bit + svMini1Bit;
  122.         svAll4BitData = svLarge4Bit + svSmall4Bit + svMini4Bit;
  123.         svAll8BitData = svLarge8Bit + svSmall8Bit + svMini8Bit;
  124.         svAllAvailableData = $ffffffff;
  125.  
  126.  
  127.     type
  128.         IconSelectorValue = LONGINT;
  129.  
  130.         IconActionProcPtr = ProcPtr;  { FUNCTION IconAction(theType: ResType; VAR theIcon: Handle; yourDataPtr: UNIV Ptr): OSErr; }
  131.         IconActionUPP = UniversalProcPtr;
  132.  
  133.     const
  134.         uppIconActionProcInfo = $00000FE0; { FUNCTION (4 byte param, 4 byte param, 4 byte param): 2 byte result; }
  135.  
  136.     function NewIconActionProc (userRoutine: IconActionProcPtr): IconActionUPP;
  137.     inline
  138.         $2E9F;
  139.  
  140.     function CallIconActionProc (theType: ResType;
  141.                                     var theIcon: Handle;
  142.                                     yourDataPtr: univ Ptr;
  143.                                     userRoutine: IconActionUPP): OSErr;
  144.     inline
  145.         $205F, $4E90;
  146.  
  147.     type
  148.         IconAction = IconActionUPP;
  149.  
  150.         IconGetterProcPtr = ProcPtr;  { FUNCTION IconGetter(theType: ResType; yourDataPtr: UNIV Ptr): Handle; }
  151.         IconGetterUPP = UniversalProcPtr;
  152.  
  153.     const
  154.         uppIconGetterProcInfo = $000003F0; { FUNCTION (4 byte param, 4 byte param): 4 byte result; }
  155.  
  156.     function NewIconGetterProc (userRoutine: IconGetterProcPtr): IconGetterUPP;
  157.     inline
  158.         $2E9F;
  159.  
  160.     function CallIconGetterProc (theType: ResType;
  161.                                     yourDataPtr: univ Ptr;
  162.                                     userRoutine: IconGetterUPP): Handle;
  163.     inline
  164.         $205F, $4E90;
  165.  
  166.     type
  167.         IconGetter = IconGetterUPP;
  168.  
  169.         CIcon = record
  170.                 iconPMap: PixMap;                                    {the icon's pixMap}
  171.                 iconMask: BitMap;                                    {the icon's mask}
  172.                 iconBMap: BitMap;                                    {the icon's bitMap}
  173.                 iconData: Handle;                                    {the icon's data}
  174.                 iconMaskData: array[0..0] of INTEGER;                {icon's mask and BitMap data}
  175.             end;
  176.         CIconPtr = ^CIcon;
  177.         CIconHandle = ^CIconPtr;
  178.  
  179.  
  180.     function GetCIcon (iconID: INTEGER): CIconHandle;
  181.     inline
  182.         $AA1E;
  183.     procedure PlotCIcon ({CONST}
  184.                                     var theRect: Rect;
  185.                                     theIcon: CIconHandle);
  186.     inline
  187.         $AA1F;
  188.     procedure DisposeCIcon (theIcon: CIconHandle);
  189.     inline
  190.         $AA25;
  191.     function GetIcon (iconID: INTEGER): Handle;
  192.     inline
  193.         $A9BB;
  194.     procedure PlotIcon ({CONST}
  195.                                     var theRect: Rect;
  196.                                     theIcon: Handle);
  197.     inline
  198.         $A94B;
  199.  
  200.     function PlotIconID ({CONST}
  201.                                     var theRect: Rect;
  202.                                     align: IconAlignmentType;
  203.                                     transform: IconTransformType;
  204.                                     theResID: INTEGER): OSErr;
  205.     inline
  206.         $303C, $0500, $ABC9;
  207.     function NewIconSuite (var theIconSuite: Handle): OSErr;
  208.     inline
  209.         $303C, $0207, $ABC9;
  210.     function AddIconToSuite (theIconData: Handle;
  211.                                     theSuite: Handle;
  212.                                     theType: ResType): OSErr;
  213.     inline
  214.         $303C, $0608, $ABC9;
  215.     function GetIconFromSuite (var theIconData: Handle;
  216.                                     theSuite: Handle;
  217.                                     theType: ResType): OSErr;
  218.     inline
  219.         $303C, $0609, $ABC9;
  220.     function ForEachIconDo (theSuite: Handle;
  221.                                     selector: IconSelectorValue;
  222.                                     action: IconActionUPP;
  223.                                     yourDataPtr: univ Ptr): OSErr;
  224.     inline
  225.         $303C, $080A, $ABC9;
  226.     function GetIconSuite (var theIconSuite: Handle;
  227.                                     theResID: INTEGER;
  228.                                     selector: IconSelectorValue): OSErr;
  229.     inline
  230.         $303C, $0501, $ABC9;
  231.     function DisposeIconSuite (theIconSuite: Handle;
  232.                                     disposeData: BOOLEAN): OSErr;
  233.     inline
  234.         $303C, $0302, $ABC9;
  235.     function PlotIconSuite ({CONST}
  236.                                     var theRect: Rect;
  237.                                     align: IconAlignmentType;
  238.                                     transform: IconTransformType;
  239.                                     theIconSuite: Handle): OSErr;
  240.     inline
  241.         $303C, $0603, $ABC9;
  242.     function MakeIconCache (var theHandle: Handle;
  243.                                     makeIcon: IconGetterUPP;
  244.                                     yourDataPtr: univ Ptr): OSErr;
  245.     inline
  246.         $303C, $0604, $ABC9;
  247.     function LoadIconCache ({CONST}
  248.                                     var theRect: Rect;
  249.                                     align: IconAlignmentType;
  250.                                     transform: IconTransformType;
  251.                                     theIconCache: Handle): OSErr;
  252.     inline
  253.         $303C, $0606, $ABC9;
  254.     function PlotIconMethod ({CONST}
  255.                                     var theRect: Rect;
  256.                                     align: IconAlignmentType;
  257.                                     transform: IconTransformType;
  258.                                     theMethod: IconGetterUPP;
  259.                                     yourDataPtr: univ Ptr): OSErr;
  260.     inline
  261.         $303C, $0805, $ABC9;
  262.     function GetLabel (labelNumber: INTEGER;
  263.                                     var labelColor: RGBColor;
  264.                                     var labelString: Str255): OSErr;
  265.     inline
  266.         $303C, $050B, $ABC9;
  267.     function PtInIconID (testPt: Point; {CONST}
  268.                                     var iconRect: Rect;
  269.                                     align: IconAlignmentType;
  270.                                     iconID: INTEGER): BOOLEAN;
  271.     inline
  272.         $303C, $060D, $ABC9;
  273.     function PtInIconSuite (testPt: Point; {CONST}
  274.                                     var iconRect: Rect;
  275.                                     align: IconAlignmentType;
  276.                                     theIconSuite: Handle): BOOLEAN;
  277.     inline
  278.         $303C, $070E, $ABC9;
  279.     function PtInIconMethod (testPt: Point; {CONST}
  280.                                     var iconRect: Rect;
  281.                                     align: IconAlignmentType;
  282.                                     theMethod: IconGetterUPP;
  283.                                     yourDataPtr: univ Ptr): BOOLEAN;
  284.     inline
  285.         $303C, $090F, $ABC9;
  286.     function RectInIconID ({CONST}
  287.                                     var testRect: Rect; {CONST}
  288.                                     var iconRect: Rect;
  289.                                     align: IconAlignmentType;
  290.                                     iconID: INTEGER): BOOLEAN;
  291.     inline
  292.         $303C, $0610, $ABC9;
  293.     function RectInIconSuite ({CONST}
  294.                                     var testRect: Rect; {CONST}
  295.                                     var iconRect: Rect;
  296.                                     align: IconAlignmentType;
  297.                                     theIconSuite: Handle): BOOLEAN;
  298.     inline
  299.         $303C, $0711, $ABC9;
  300.     function RectInIconMethod ({CONST}
  301.                                     var testRect: Rect; {CONST}
  302.                                     var iconRect: Rect;
  303.                                     align: IconAlignmentType;
  304.                                     theMethod: IconGetterUPP;
  305.                                     yourDataPtr: univ Ptr): BOOLEAN;
  306.     inline
  307.         $303C, $0912, $ABC9;
  308.     function IconIDToRgn (theRgn: RgnHandle; {CONST}
  309.                                     var iconRect: Rect;
  310.                                     align: IconAlignmentType;
  311.                                     iconID: INTEGER): OSErr;
  312.     inline
  313.         $303C, $0613, $ABC9;
  314.     function IconSuiteToRgn (theRgn: RgnHandle; {CONST}
  315.                                     var iconRect: Rect;
  316.                                     align: IconAlignmentType;
  317.                                     theIconSuite: Handle): OSErr;
  318.     inline
  319.         $303C, $0714, $ABC9;
  320.     function IconMethodToRgn (theRgn: RgnHandle; {CONST}
  321.                                     var iconRect: Rect;
  322.                                     align: IconAlignmentType;
  323.                                     theMethod: IconGetterUPP;
  324.                                     yourDataPtr: univ Ptr): OSErr;
  325.     inline
  326.         $303C, $0915, $ABC9;
  327.     function SetSuiteLabel (theSuite: Handle;
  328.                                     theLabel: INTEGER): OSErr;
  329.     inline
  330.         $303C, $0316, $ABC9;
  331.     function GetSuiteLabel (theSuite: Handle): INTEGER;
  332.     inline
  333.         $303C, $0217, $ABC9;
  334.     function GetIconCacheData (theCache: Handle;
  335.                                     theData: univ Ptr): OSErr;
  336.     inline
  337.         $303C, $0419, $ABC9;
  338.     function SetIconCacheData (theCache: Handle;
  339.                                     theData: univ Ptr): OSErr;
  340.     inline
  341.         $303C, $041A, $ABC9;
  342.     function GetIconCacheProc (theCache: Handle;
  343.                                     var theProc: IconGetterUPP): OSErr;
  344.     inline
  345.         $303C, $041B, $ABC9;
  346.     function SetIconCacheProc (theCache: Handle;
  347.                                     theProc: IconGetterUPP): OSErr;
  348.     inline
  349.         $303C, $041C, $ABC9;
  350.     function PlotIconHandle ({CONST}
  351.                                     var theRect: Rect;
  352.                                     align: IconAlignmentType;
  353.                                     transform: IconTransformType;
  354.                                     theIcon: Handle): OSErr;
  355.     inline
  356.         $303C, $061D, $ABC9;
  357.     function PlotSICNHandle ({CONST}
  358.                                     var theRect: Rect;
  359.                                     align: IconAlignmentType;
  360.                                     transform: IconTransformType;
  361.                                     theSICN: Handle): OSErr;
  362.     inline
  363.         $303C, $061E, $ABC9;
  364.     function PlotCIconHandle ({CONST}
  365.                                     var theRect: Rect;
  366.                                     align: IconAlignmentType;
  367.                                     transform: IconTransformType;
  368.                                     theCIcon: CIconHandle): OSErr;
  369.     inline
  370.         $303C, $061F, $ABC9;
  371.  
  372. implementation
  373. end.